package com.bolang.onlycode.demo.activemq;

import groovy.util.logging.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.jms.Queue;
import javax.jms.Topic;

@Slf4j
@Component
public class Producer {
    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    @Autowired
    private Queue queue;
    @Autowired
    private Topic topic;

    public void sendQueue(String msg)
    {
        this.jmsMessagingTemplate.convertAndSend(this.queue, msg);
    }
    public void sendTopic(String msg)
    {
        this.jmsMessagingTemplate.convertAndSend(this.topic, msg);
    }
}
